package demo.repository;

import demo.entity.Bonus;
import demo.entity.Seek;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface SeekRepository extends JpaRepository<Seek, Long> {

    /**
     * 按 邀请码 检查邀请码是否已经存在
     *
     * @param invitingCode
     * @return
     */
    Boolean existsByInvitingCodeAndValidIsTrue(String invitingCode);

    Boolean existsByUidAndCompanyIdAndValidIsTrue(Long uid, Long companyId);

    List<Seek> findSeeksByUidAndCompanyIdAndValidIsTrue(Long uid, Long companyId);

    List<Seek> findSeeksByInvitingCodeAndValidIsTrue(String invitingCode);
}
